﻿using System;
using Framework;

namespace Enterprise.Admin.Handle
{
    /// <summary>
    /// 修改招聘资料
    /// </summary>
    public partial class EditRecruitment : AdminBasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            object result;
            try
            {
                var id = Fq("CoRecruitmentId").SafeToInt();
                string post = Fq("CoPost").SafeToString();
                string postDescription = Fq("CoPostDescription").SafeToString();
                string number = Fq("CoNumber").SafeToString();
                string monthlySalary = Fq("CoMonthlySalary").SafeToString();
                string workPlace = Fq("CoWorkPlace").SafeToString();
                string workExperience = Fq("CoWorkExperience").SafeToString();
                string education = Fq("CoEducation").SafeToString();
                string age = Fq("CoAge").SafeToString();
                DateTime date = Fq("CoDate").SafeToDateTime();
                DateTime validDate = Fq("CoValidDate").SafeToDateTime();
                string language = Fq("CoLanguage").SafeToString();
                string assess = Fq("CoAssess").SafeToString();
                string candidates = Fq("CoCandidates").SafeToString();
                string email = Fq("CoEmail").SafeToString();
                string contact = Fq("CoContact").SafeToString();
                string otherTreatment = Fq("CoOtherTreatment").SafeToString();
                string qq = Fq("CoQq").SafeToString();
                string workType = Fq("CoWorkType").SafeToString();
                string sex = Fq("CoSex").SafeToString();
                var recruitmentService = new RecruitmentService();
                recruitmentService.Edit(id, post, postDescription, number, monthlySalary,
                                       workPlace, workExperience, education, age, date,
                                       validDate, language, assess, candidates, email,
                                       contact, otherTreatment, qq, workType,sex);
                result = new { state = true, message = "修改成功！" };
            }
            catch (Exception ex)
            {
                result = new { state = false, message = ex.Message };
            }
            Json(result);
        }
    }
}